using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using Common.Properties;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Common.Base
{
	public class XProgressForm : XtraForm
	{
		private ProgressBarControl progressBarControl1;
		private LabelControl lblTitle;
		private IContainer components;
		private LabelControl lblMessage;
		private PictureBox pictureBox1;
		private LabelControl lbCopyRight;
		private readonly Form _form;
		private bool _die;
		private bool AutoClose
		{
			get;
			set;
		}
		protected override void Dispose(bool disposing)
		{
			this._die = true;
			if (disposing)
			{
				if (this.components != null)
				{
					this.components.Dispose();
				}
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.progressBarControl1 = new ProgressBarControl();
			this.lblTitle = new LabelControl();
			this.lblMessage = new LabelControl();
			this.pictureBox1 = new PictureBox();
			this.lbCopyRight = new LabelControl();
			((ISupportInitialize)this.progressBarControl1.Properties).BeginInit();
			((ISupportInitialize)this.pictureBox1).BeginInit();
			base.SuspendLayout();
			this.progressBarControl1.AllowHtmlTextInToolTip = DefaultBoolean.True;
			this.progressBarControl1.Location = new Point(8, 150);
			this.progressBarControl1.Name = "progressBarControl1";
			this.progressBarControl1.Properties.AutoHeight = true;
			this.progressBarControl1.Properties.EditValueChangedFiringMode = EditValueChangedFiringMode.Buffered;
			this.progressBarControl1.Properties.ExportMode = ExportMode.Value;
			this.progressBarControl1.Properties.ProgressViewStyle = ProgressViewStyle.Solid;
			this.progressBarControl1.Properties.ShowTitle = true;
			this.progressBarControl1.Properties.StartColor = SystemColors.GradientActiveCaption;
			this.progressBarControl1.Properties.UseParentBackground = true;
			this.progressBarControl1.Size = new Size(437, 20);
			this.progressBarControl1.TabIndex = 0;
			this.lblTitle.AllowHtmlString = true;
			this.lblTitle.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lblTitle.Appearance.ForeColor = Color.Black;
			this.lblTitle.Appearance.Options.UseFont = true;
			this.lblTitle.Appearance.Options.UseForeColor = true;
			this.lblTitle.AutoEllipsis = true;
			this.lblTitle.AutoSizeMode = LabelAutoSizeMode.None;
			this.lblTitle.Location = new Point(11, 104);
			this.lblTitle.Name = "lblTitle";
			this.lblTitle.Size = new Size(430, 19);
			this.lblTitle.TabIndex = 63;
			this.lblTitle.Text = "...";
			this.lblMessage.AllowHtmlString = true;
			this.lblMessage.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.lblMessage.Appearance.ForeColor = Color.Black;
			this.lblMessage.Appearance.Options.UseFont = true;
			this.lblMessage.Appearance.Options.UseForeColor = true;
			this.lblMessage.AutoEllipsis = true;
			this.lblMessage.AutoSizeMode = LabelAutoSizeMode.None;
			this.lblMessage.Location = new Point(11, 127);
			this.lblMessage.Name = "lblMessage";
			this.lblMessage.Size = new Size(431, 20);
			this.lblMessage.TabIndex = 64;
			this.lblMessage.Text = "...";
			this.pictureBox1.BackColor = Color.Transparent;
			this.pictureBox1.Image = Resources.Toro;
			this.pictureBox1.Location = new Point(6, 28);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new Size(435, 72);
			this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
			this.pictureBox1.TabIndex = 65;
			this.pictureBox1.TabStop = false;
			this.lbCopyRight.AllowHtmlString = true;
			this.lbCopyRight.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.lbCopyRight.Appearance.ForeColor = Color.Black;
			this.lbCopyRight.Appearance.Options.UseFont = true;
			this.lbCopyRight.Appearance.Options.UseForeColor = true;
			this.lbCopyRight.AutoEllipsis = true;
			this.lbCopyRight.AutoSizeMode = LabelAutoSizeMode.None;
			this.lbCopyRight.Location = new Point(7, 3);
			this.lbCopyRight.Name = "lbCopyRight";
			this.lbCopyRight.Size = new Size(430, 19);
			this.lbCopyRight.TabIndex = 66;
			this.lbCopyRight.Text = "Copyright © Perfect Software Co.,Ltd - Công Ty Phần Mềm Hoàn Hảo";
			this.AutoScaleBaseSize = new Size(5, 14);
			base.ClientSize = new Size(457, 176);
			base.ControlBox = false;
			base.Controls.Add(this.lbCopyRight);
			base.Controls.Add(this.pictureBox1);
			base.Controls.Add(this.lblMessage);
			base.Controls.Add(this.lblTitle);
			base.Controls.Add(this.progressBarControl1);
			this.DoubleBuffered = true;
//			this.FormBorderStyle = FormBorderStyle.FixedDialog;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "XProgressForm";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			base.TopMost = true;
			((ISupportInitialize)this.progressBarControl1.Properties).EndInit();
			((ISupportInitialize)this.pictureBox1).EndInit();
			base.ResumeLayout(false);
		}
		public XProgressForm()
		{
			this.InitializeComponent();
		}
		public void SetProgressValue(int position, string message)
		{
			this.SetProgressValue(position, message, "Vui lòng đợi trong giây lát");
		}
		public void SetProgressValue(int position, string message, string caption)
		{
			if (!this._die)
			{
				if (!base.Visible)
				{
					if (this._form != null)
					{
						base.Show(this._form);
					}
					else
					{
						base.Show();
					}
				}
				this.lblMessage.Text = message;
				this.progressBarControl1.Position = position;
				this.lblTitle.Text = caption;
				base.Update();
				if (position >= 100 && this.AutoClose)
				{
					base.Visible = false;
				}
			}
		}
		protected override void OnPaint(PaintEventArgs e)
		{
		}
	}
}
